﻿@{ 
    int tableId = ViewBag.TableId;
    CurrentUser user = ViewBag.CurrentUser;
}

<div class="main">
    <form method="post" id="form" class=" form-control-sm form form-lg">

        <div class="form-group">
            <label class="control-label">目标栏目<input type="checkbox" name="_columnId" /></label>
            <div class="controls form-inline">
                <select name="columnId" id="columnId" class="form-control" style="width:auto" data-source="@Html.GetColumnListJsonByUser(tableId,user)">
                    <option value="0">选择目标栏目</option>
                </select>
                <span class="help-block">只有选择最终栏目才有效。</span>
            </div>
        </div>

        <div class="form-group">
            <label class="control-label">推荐属性<input type="checkbox" name="_isGood" /></label>
            <div class="controls form-inline">
                <select name="isGood" id="isGood" class="form-control" style="width:auto">
                    <option value="0">不推荐</option>
                    <option value="1">1级推荐</option>
                    <option value="2">2级推荐</option>
                    <option value="3">3级推荐</option>
                    <option value="4">4级推荐</option>
                    <option value="5">5级推荐</option>
                    <option value="6">6级推荐</option>
                    <option value="7">7级推荐</option>
                    <option value="8">8级推荐</option>
                    <option value="9">9级推荐</option>
                    <option value="10">10级推荐</option>
                </select>
                <span class="help-block"></span>
            </div>
        </div>

        <div class="form-group">
            <label class="control-label">热门属性<input type="checkbox" name="_isHot" /></label>
            <div class="controls form-inline">
                <select name="isHot" id="isHot" class="form-control" style="width:auto">
                    <option value="0">不热门</option>
                    <option value="1">1级热门</option>
                    <option value="2">2级热门</option>
                    <option value="3">3级热门</option>
                    <option value="4">4级热门</option>
                    <option value="5">5级热门</option>
                    <option value="6">6级热门</option>
                    <option value="7">7级热门</option>
                    <option value="8">8级热门</option>
                    <option value="9">9级热门</option>
                    <option value="10">10级热门</option>
                </select>
                <span class="help-block"></span>
            </div>
        </div>

        <div class="form-group">
            <label class="control-label">置顶属性<input type="checkbox" name="_isTop" /></label>
            <div class="controls form-inline">
                <select name="isTop" id="isTop" class="form-control" style="width:auto">
                    <option value="0">不置顶</option>
                    <option value="1">1级置顶</option>
                    <option value="2">2级置顶</option>
                    <option value="3">3级置顶</option>
                    <option value="4">4级置顶</option>
                    <option value="5">5级置顶</option>
                    <option value="6">6级置顶</option>
                    <option value="7">7级置顶</option>
                    <option value="8">8级置顶</option>
                    <option value="9">9级置顶</option>
                    <option value="10">10级置顶</option>
                </select>
                <span class="help-block"></span>
            </div>
        </div>

        <div class="form-group">
            <label class="control-label">点击数<input type="checkbox" name="_clicks" /></label>
            <div class="controls form-inline">
                <input type="text" value="0" name="clicks" id="clicks" data-validate="dataType:'numeric'" class="form-control form-control-xs" />
                <span class="help-block"></span>
            </div>
        </div>

        <div class="form-group">
            <label class="control-label">预上线日期<input type="checkbox" name="__onlineDate" /></label>
            <div class="controls form-inline">
                <input type="text" name="_onlineDate" id="_onlineDate" class="form-control laydate-icon" value="@ViewBag.OnlineDate" onclick="laydate({istime: true,format:'YYYY-MM-DD hh:mm:ss'})" />
                <span class="help-block">预上线日期大于当前时间后自动上线（is_online字段值更新为1），不填写则信息默认为上线状态。</span>
            </div>
        </div>

        <div class="form-group">
            <label class="control-label">到期日期<input type="checkbox" name="__expireDate" /></label>
            <div class="controls form-inline">
                <input type="text" name="_expireDate" id="_expireDate" class="form-control laydate-icon" value="@ViewBag.ExpireDate" onclick="laydate({istime: true,format:'YYYY-MM-DD hh:mm:ss'})" />
                <span class="help-block">当前日期大于所设置的过期日期后，信息将自动到期（is_expire字段值更新为1），不填写则不进行任何处理。</span>
            </div>
        </div>

        <div class="form-group template_set_box" data-source="@ViewBag.TemplateSet">
            <label class="control-label">信息页模版<input type="checkbox" name="_template_set_templateDetail" /></label>
            <div class="controls form-inline">
                <input type="text" placeholder="信息页的模板文件" maxlength="100" id="template_set_templateDetail" name="template_set_templateDetail" class="form-control" />
                <button type="button" class="btn btn-default btn-sm ui-dialog" data-custom-params="title:'选择信息页模版',url:'@Url.ActionUrl("Select", "TemplateManager")?objname=#template_set_templateDetail',width:'80%',height:'90%',target:'self'">选择</button>
                <span class="help-block">不填写则继承栏目设置中的内容页模板</span>
            </div>
        </div>

        <div class="form-group">
            <label class="control-label">自定义文件名<input type="checkbox" name="_url_set_ZdyPath" /></label>
            <div class="controls">
                <input name="url_set_ZdyPath" id="url_set_ZdyPath" type="text" maxlength="50" class="form-control" data-validate="dataType:'string',ignoreEmpty:true,errorMsg:'只能填写英文和数字组成的字符！'">
                <span class="help-block">不能填写纯数字，留空则采用Id作为文件名。</span>
            </div>
        </div>

        <div class="form-group">
            <label class="control-label">自定义链接<input type="checkbox" name="_url_set_ZdyUrl" /></label>
            <div class="controls">
                <input name="url_set_ZdyUrl" id="url_set_ZdyUrl" type="text" maxlength="150" class="form-control">
                <span class="help-block">留空则系统默认</span>
            </div>
        </div>

        <div class="postarea">
            <div class="form-group">
                <div class="controls">
                    <input type="hidden" name="ids" id="ids" />
                    <button type="button" class="btn btn-sm btn-primary ui-pagePost" data-custom-params="url:'@Url.ActionUrl()',callBack:'PostBack',beforeExecute:'BeforePost',accordingObj:'#form'">提交</button>
                    <button type="button" class="btn btn-sm btn-default ui-closeDialog">关闭</button>
                </div>
            </div>
        </div>
    </form>
</div>
<script type="text/javascript">
    var $ids = $("#ids");
    var $parentIds = parent.$(".checked-item");
    if ($parentIds.length == 0)
    {
        $(".main").html("父级对象未找到！")
    }
    var ids = $parentIds.GetValue();
    $ids.val(ids)
    $("#columnId").SelectBind({ dataSourceFrom: "attr", isTree: true, onlySelectFinal: true, linkage: true});

    function BeforePost() {
        var ids = $ids.val();
        if (ids == "") {
            Msg("请选择要设置的信息!");
            return false;
        }
        return true;
    }
</script>
